package com.baor.controller;


import com.baor.domain.MenuVo;
import com.baor.service.MenuService;
import com.baor.utils.AjaxResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/menu")
public class MenuController {

    @Autowired
    private MenuService menuService;

    @RequestMapping("/menuList")
    public AjaxResult<?> menuList(){
        return menuService.menuList();
    }

    @RequestMapping("/insertMenu")
    public AjaxResult<?> insertMenu(@RequestBody MenuVo vo){
        return menuService.insertMenu(vo);
    }

    @RequestMapping("/update")
    public AjaxResult<?> update(@RequestBody MenuVo vo){
        return menuService.update(vo);
    }

    @RequestMapping("/delete")
    public AjaxResult<?> delete(@RequestBody MenuVo vo){
        return menuService.delete(vo.getMenuId());
    }

    @RequestMapping("/search")
    public AjaxResult<?> search(@RequestBody MenuVo menuVo){
        return menuService.search(menuVo);
    }

}
